<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: ActionView::TemplateFinder</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">ActionView::TemplateFinder</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/vendor/plugins/active_scaffold/lib/extensions/generic_view_paths_rb.html">
                vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="../Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000071">find_generic_base_path_for</a>&nbsp;&nbsp;
      <a href="#M000070">find_template_extension_from_handler_with_generic_paths</a>&nbsp;&nbsp;
      <a href="#M000069">pick_template_with_generic_paths</a>&nbsp;&nbsp;
      <a href="#M000072">search_generic_view_paths?</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">



    <div id="aliases-list">
      <h3 class="section-bar">External Aliases</h3>

      <div class="name-list">
                        <table summary="aliases">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">pick_template</td>
          <td>-&gt;</td>
          <td class="context-item-value">template_exists?</td>
        </tr>
                        </table>
      </div>
    </div>


    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">controller</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000071" class="method-detail">
        <a name="M000071"></a>

        <div class="method-heading">
          <a href="#M000071" class="method-signature">
          <span class="method-name">find_generic_base_path_for</span><span class="method-args">(template_file_name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the view path that contains the given relative template path.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000071-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000071-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb, line 54</span>
54:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_generic_base_path_for</span>(<span class="ruby-identifier">template_file_name</span>)
55:     <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">generic_view_paths</span>.<span class="ruby-identifier">find</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">p</span>, <span class="ruby-identifier">template_file_name</span>)) }
56:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000070" class="method-detail">
        <a name="M000070"></a>

        <div class="method-heading">
          <a href="#M000070" class="method-signature">
          <span class="method-name">find_template_extension_from_handler_with_generic_paths</span><span class="method-args">(template_path, template_format = @template.template_format)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000070-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000070-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb, line 39</span>
39:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_template_extension_from_handler_with_generic_paths</span>(<span class="ruby-identifier">template_path</span>, <span class="ruby-identifier">template_format</span> = <span class="ruby-ivar">@template</span>.<span class="ruby-identifier">template_format</span>)
40:     <span class="ruby-identifier">extension</span> = <span class="ruby-identifier">find_template_extension_from_handler_without_generic_paths</span>(<span class="ruby-identifier">template_path</span>, <span class="ruby-identifier">template_format</span>)
41:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">extension</span>.<span class="ruby-identifier">blank?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">search_generic_view_paths?</span>
42:       <span class="ruby-identifier">template_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">template_path</span>)
43:       <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">generic_view_paths</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span>
44:         <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">template_handler_extensions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">handler_extension</span><span class="ruby-operator">|</span>
45:           <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">handler_extension</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">path</span>, <span class="ruby-node">&quot;#{template_file}.#{handler_extension}&quot;</span>))
46:         <span class="ruby-keyword kw">end</span>
47:       <span class="ruby-keyword kw">end</span>
48:     <span class="ruby-keyword kw">end</span>
49:     <span class="ruby-identifier">extension</span>
50:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000069" class="method-detail">
        <a name="M000069"></a>

        <div class="method-heading">
          <a href="#M000069" class="method-signature">
          <span class="method-name">pick_template_with_generic_paths</span><span class="method-args">(template_path, extension)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000069-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000069-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb, line 27</span>
27:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pick_template_with_generic_paths</span>(<span class="ruby-identifier">template_path</span>, <span class="ruby-identifier">extension</span>)
28:     <span class="ruby-identifier">path</span> = <span class="ruby-identifier">pick_template_without_generic_paths</span>(<span class="ruby-identifier">template_path</span>, <span class="ruby-identifier">extension</span>)
29:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">blank?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">search_generic_view_paths?</span>
30:       <span class="ruby-identifier">template_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-node">&quot;#{template_path}.#{extension}&quot;</span>)
31:       <span class="ruby-identifier">path</span> = <span class="ruby-identifier">find_generic_base_path_for</span>(<span class="ruby-identifier">template_file</span>)
32:       <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span> <span class="ruby-value">? </span><span class="ruby-node">&quot;#{path}/#{template_file}&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
33:     <span class="ruby-keyword kw">end</span>
34:     <span class="ruby-identifier">path</span>
35:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000072" class="method-detail">
        <a name="M000072"></a>

        <div class="method-heading">
          <a href="#M000072" class="method-signature">
          <span class="method-name">search_generic_view_paths?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
We don&#8216;t want to use generic_view_paths in ActionMailer, and we
don&#8216;t want to use them unless the controller action was explicitly
defined.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000072-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000072-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/extensions/generic_view_paths.rb, line 60</span>
60:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">search_generic_view_paths?</span>
61:     <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:generic_view_paths</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">action_methods</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">controller</span>.<span class="ruby-identifier">action_name</span>)
62:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>